<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>产品分类管理</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link href="${ctxPath}/static/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<script src="${ctxPath}/static/admin/js/plugins/sweetalert/sweetalert.min.js"></script>
<link rel="shortcut icon" href="${ctxPath}/views/admin/favicon.ico">
<link href="${ctxPath}/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctxPath}/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="${ctxPath}/static/admin/css/animate.css" rel="stylesheet">
<link href="${ctxPath}/static/admin/css/style.css?v=4.1.0" rel="stylesheet">

<style>
.center {
	text-align: center;
}
</style>
</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInUp">
		<div class="row">
			<div class="col-sm-12">

				<div class="ibox">
					<div class="ibox-title">
						<h5>产品分类详情</h5>
						<div class="ibox-tools">
							<a href="${ctxPath}/productType/edit"
								class="btn btn-primary btn-xs">添加新分类</a>
						</div>
					</div>
					<div class="ibox-content">
						<div class="project-list">

							<table class="table table-hover">
								<thead>
									<tr>

										<th class="center">分类名称</th>
										<th class="center">分类图片</th>
										<th class="center">分类排序</th>
										<th class="center">操作</th>
									</tr>
								</thead>
								<tbody>
									<!--# for(var res in data){ -->
										<tr>
											<td class="project-title center">
												<p>${res.type_name!}</p> 
											</td>
											<td class="project-people center">
	                                            <p><img alt="image" src="${ctxPath}/down/downProductTypeImg?imgUrl=${res.type_img!}" style="width:80px; height:80px;"></p>
	                                        </td>
											<td class="project-people center">
												<p>${res.sort!}</p>
											</td>
											<td class="project-actions center">
												<a class="btn btn-white btn-sm" href="${ctxPath}/productType/edit?id=${res.id!}">
													<i class="fa fa-pencil"></i>编辑 
												</a> 
												<a class="btn btn-white btn-sm" href="javascript:void(0);" onclick="Delete('${res.id!}')">
													<i class="fa fa-pencil" ></i> 删除 
												</a>
											</td>
										</tr>
									<!--# } -->
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- 全局js -->
	<script src="${ctxPath}/static/admin/js/jquery.min.js?v=2.1.4"></script>
	<script src="${ctxPath}/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="${ctxPath}/static/admin/js/plugins/webuploader/webuploader.js"></script>
	<script src="${ctxPath}/static/js/ajaxfileupload.js"></script>


	<!-- 自定义js -->
	<script src="${ctxPath}/static/admin/js/content.js?v=1.0.0"></script>


	<script>
        $(document).ready(function(){

            $('#loading-example-btn').click(function () {
                btn = $(this);
                simpleLoad(btn, true)

                // Ajax example
//                $.ajax().always(function () {
//                    simpleLoad($(this), false)
//                });

                simpleLoad(btn, false)
            });
        });

        function simpleLoad(btn, state) {
            if (state) {
                btn.children().addClass('fa-spin');
                btn.contents().last().replaceWith(" Loading");
            } else {
                setTimeout(function () {
                    btn.children().removeClass('fa-spin');
                    btn.contents().last().replaceWith(" Refresh");
                }, 2000);
            }
        }
    </script>
	<script type="text/javascript">
	     function Delete(id){
	    	 swal({  
	             title:"警告",  
	             text:"数据删除后将无法恢复,您确定要删除当前数据吗?",  
	             type:"warning",  
	             showCancelButton:true,
	             confirmButtonColor: "#DD6B55",
	             closeOnConfirm: false,
	             confirmButtonText:"确定",
	             cancelButtonText:"取消"
	           },function(){
			     	 $.post("${ctxPath}/productType/delete", {'id':id}, function(data) {
						if(data.code == 0){
			 				swal({
		                  		  title: "提示",
		                  		  text: "删除成功",
		                  		  timer: 2000,
		                  		  showConfirmButton: false
			                  	});
			                  	setTimeout(function(){
			                  		location.reload();
			                  	},2100);
			 		    }else{
			 				swal("操作失败", "数据删除失败!", "error");
			 		    }
					 })
	           })
	     }
     </script>


</body>
</html>
